﻿using System;
using System.Threading.Tasks;
using Hangfire;
using Hangfire.MemoryStorage;
using Microsoft.Owin;
using Owin;

[assembly: OwinStartup(typeof(Hello_Hangfire.Startup))]

namespace Hello_Hangfire
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            // 有关如何配置应用程序的详细信息，请访问 http://go.microsoft.com/fwlink/?LinkID=316888


            //指定Hangfire使用内存存储后台任务信息
            //GlobalConfiguration.Configuration.UseMemoryStorage();

            //SqlServer
            //GlobalConfiguration.Configuration.UseSqlServerStorage("server=192.168.0.201;database=PDRZ_Integration;uid=sa;pwd=1qaz@WSX");

            //Redis
            GlobalConfiguration.Configuration.UseRedisStorage("localhost:6379");

            //启用HangfireServer这个中间件（它会自动释放）
            app.UseHangfireServer();
            //启用Hangfire的仪表盘（可以看到任务的状态，进度等信息）
            app.UseHangfireDashboard();
             
        }
    }
}
